using System;
using UnityEngine;
using QFramework;

namespace ProjectMyFarmAndShe
{
	public partial class ResController : ViewController
	{
		public static ResController Default;
		
		public SpriteSO SpriteSo;

		private ResLoader mResLoader = ResLoader.Allocate();

		private void Awake()
		{
			Default = this;
		}

		void Start()
		{
			// Code Here
			SpriteSo = mResLoader.LoadSync<SpriteSO>("SpriteSO");
		}

		/// <summary>
		/// 通过关键字获取工具sprite
		/// </summary>
		/// <param name="key"></param>
		/// <returns></returns>
		public Sprite GetToolIconGetKey(string key)
		{
			return SpriteSo.GetSpriteByKey(key);
		}

		private void OnDestroy()
		{
			Default = null;
			mResLoader.Recycle2Cache();
		}
	}
}
